<template>
	<view style="background-color: #f1f1f1;height: 100vh;">
		<view class="top">
			<view class="topOne">
				<view class="topOne-left">
					<text>基础信息</text>
				</view>
				<view class="topOne-right">
					<text>设备编号：{{dataList.YDVNUM}}</text>
				</view>
			</view>
			<view class="two">
				<view class="two-one">
					<view class="two-oneLeft">设备名称 :</view>
					<view class="two-oneRight">{{dataList.YDENAM}}</view>
				</view>
				<view class="two-one">
					<view class="two-oneLeft">规格型号 :</view>
					<view class="two-oneRight">{{dataList.YGG}}</view>
				</view>
				<view class="two-one">
					<view class="two-oneLeft">生产厂家 :</view>
					<view class="two-oneRight">{{dataList.YMANFAC}}</view>
				</view>
				<view class="two-one">
					<view class="two-oneLeft">启用日期 :</view>
					<view class="two-oneRight">{{dataList.YUSEDAT}}</view>
				</view>
				<view class="two-one">
					<view class="two-oneLeft">位置 :</view>
					<view class="two-oneRight">{{dataList.YZFNUM}}</view>
				</view>
				<!-- <view class="two-one">
					<view class="two-oneLeft">地点 :</view>
					<view class="two-oneRight">{{dataList.YCDIDIAN}}</view>
				</view> -->
				<!-- <view class="two-one">
					<view class="two-oneLeft">关联产品 :</view>
					<view class="two-oneRight">{{dataList.ITMREF}}</view>
				</view>
				<view class="two-one">
					<view class="two-oneLeft">产品名称 :</view>
					<view class="two-oneRight">{{dataList.ITMDES1}}</view>
				</view>	 -->
			</view>
		</view>
		<view class="jlBox">
			<view class="btnBox">
				<view class="btnBox-right">
					<u-button class="rgzxBox-btn2" type="primary" 
					style="margin-left: 180rpx;margin-top: -100rpx;" color="red"
					@click="okBtn">一键报修</u-button>
				</view>
			</view>
			<br>
			<view class="btnBox">
				<view class="btnBox-right">
					<u-button class="rgzxBox-btn2" type="primary" 
					style="margin-left: 180rpx;margin-top: -100rpx;"
					@click="okBtn2">点检</u-button>
				</view>
			</view>
			<br>
			<view class="btnBox">
				<view class="btnBox-right">
					<u-button class="rgzxBox-btn2" type="primary" 
					style="margin-left: 180rpx;margin-top: -100rpx;"
					@click="okBtn3">保养</u-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show:false,
				title:'确认撤销',
				content:'您确定要撤销此单子吗？',
				cdData:{},
				dh:'',
				dataList: {},
				dataList2: [],
				num:'',
			}
		},
		onLoad(query) {
			this.num = query.num || 'KXS-004-03';
			this.init()
		},
		methods: {
			init(){
				let GRP1 = {
						GRP1: [{
							YDVNUM: this.num
						}]
				}
				let GRP1Json = JSON.stringify(GRP1)
				// console.log(GRP1Json);
				uni.request({
				  url: 'http://125.64.76.148:8125/KXJDX3Api/x3api', // 替换为实际的接口URL
				  method: 'POST', 
				  data: {
					"username":"APIUSER",
					"passwd":"123",
					"publicName":"WSLISTXDV",
					"method":"run",
					"test":uni.getStorageSync('test') ? "true" : "false",
					"inputXml":JSON.stringify(GRP1)
				  },
				  success: (res) => {
					// 请求成功的处理逻辑
					let resR1 = JSON.parse(res.data.message)
					this.dataList= resR1.GRP1[0] 
					console.log(this.dataList,'新报修数据');
					// var files = resR1.GRP3
					// for (var i = 0; i < files.length; i++) {
					// 	this.urls.push(files[i].URL)
					// }
				  },
				  fail: (err) => {
					// 请求失败的处理逻辑
					console.error(err);
				  }
				});
			},
			okBtn(){
				// 使用 uni.navigateTo 跳转到 my 页面，并传递数据
				// uni.setStorageSync({key:'YDVNUM',data:this.num})
				uni.setStorageSync('YDVNUM',this.dataList);
				uni.switchTab({url:"/pages/index/index?num=["+this.num+"]"+this.dataList.YDENAM})
			},
			okBtn2(){
				uni.setStorageSync('YDVNUM',this.dataList);
				uni.navigateTo({url:"/pages/zcdaPages/dianjianPages?num="+this.num})
			},
			okBtn3(){
				uni.setStorageSync('YDVNUM',this.dataList);
				uni.navigateTo({url:"/pages/bydjPages/bydjPages?num="+this.num})
			}
		}
	}
</script>

<style>
.top{
	width: 90%;
	/* height: 350rpx; */
	background-color: white;
	position: relative;
	top: 50rpx;
	margin: 0 auto;
}
.topOne{
	height: 90rpx;
	border-bottom: 1px solid #ccc;
	display: flex;
	justify-content: space-between;
}
.topOne-left{
	width: 230rpx;
	font-weight: bold;
	font-size: 36rpx;
	text-align: center;
	padding-top: 20rpx;
}
.topOne-right{
	width: 400rpx;
	text-align: center;
	padding-top: 20rpx;
	color: gray;
	font-size: 28rpx;
}
.two{
	/* height: 300rpx; */
	background-color: white;
}
.two-one{
	/* height: 60rpx; */
	display: flex;
	justify-content: space-between;
}
.two-oneLeft{
	width: 190rpx;
	line-height: 68rpx;
	color: gray;
	text-align: center;
}
.two-oneRight{
	width: 350rpx;
	line-height: 68rpx;
	color: gray;
	text-align: center;
}
.two2{
	height: 250rpx;
	background-color: white;
}
.two2-one{
	height: 60rpx;
	display: flex;
	justify-content: space-between;
}
.two2-oneLeft{
	width: 190rpx;
	line-height: 68rpx;
	color: gray;
	text-align: center;
}
.two2-oneRight{
	width: 350rpx;
	line-height: 68rpx;
	color: gray;
	text-align: center;
}
.wxxx{
	width: 90%;
	/* height: 350rpx; */
	background-color: white;
	position: relative;
	top: 100rpx;
	margin: 0 auto;
}
.wxxxOne{
	height: 90rpx;
	border-bottom: 1px solid #ccc;
	display: flex;
	justify-content: space-between;
}
.wxxxOne-left{
	width: 230rpx;
	font-weight: bold;
	font-size: 36rpx;
	text-align: center;
	padding-top: 20rpx;
}
.ddlcjlBox{
	width: 90%;
	height: 250rpx;
	position: relative;
	top: 160rpx;
	margin: 0 auto;
	background-color: white;
}
.ddlcjlBox-top{
	height: 70rpx;
	color: gray;
	text-align: center;
	font-size: 38rpx;
	padding-top: 15rpx;
}
.ddlcjlBox-two{
	height: 50rpx;
	display: flex;
	justify-content: space-between;
	color: gray;
	padding-left: 15rpx;
}
.ddlcjlBox-twoLeft{ 
	width: 320rpx;
}
.ddlcjlBox-twoCenter{
	width: 100rpx;
}
.ddlcjlBox-twoRightr{
	width: 100rpx;
}
.bcjlBox{
    width: 90%;
	height: 70rpx;
	position: relative;
	top: 200rpx;
	margin: 0 auto;
	background-color: white;
	color: gray;
	font-size: 32rpx;
	padding-top: 20rpx;
	padding-left: 20rpx;
}
.jlBox{
	width: 90%;
	height: 00rpx;
	/* position: relative;
	top: 250rpx;
	margin: 0 auto; */
	background-color: white;
	font-size: 42rpx;
	padding-top: 0rpx;
	padding-left: 300rpx;
}
.btnBox{
	width: 100%;
	height: 80rpx;
	position: relative;
	top: 200rpx;
	left: -270rpx;
	display: flex;
	justify-content: space-between;
}
.btnBox-left{
	width: 350rpx;
	border-right: 1px solid #ccc;
}
.btnBox-right{
	width: 350rpx;
}
</style>
